{extend name="/index/base" /}

{block name="content"}
<style>
    .layui-form-checkbox span{width: 100px}
</style>
<div class="layui-card">
    <div class="layui-card-header layuiadmin-card-header-auto">
        <h2>用户【{$user['username']}】分配角色</h2>
    </div>
    <div class="layui-card-body">
        <form class="layui-form" action="" method="post">
            <div class="layui-form-item">
                <label for="" class="layui-form-label">角色</label>
                <div class="layui-input-block" style="width: 400px">
                    {foreach $roles as $role}
                    <input type="checkbox" name="roles[]" value="{$role['id']}" title="{$role['title']}" {if in_array($role['id'], $user['authorize']) } checked {/if} >
                    {/foreach}
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" type='submit'>保 存</button>
                    <a  class="layui-btn" href="{:URL('admin/user/index')}" >返 回</a>
                </div>
            </div>
        </form>
    </div>
</div>

{/block}


{block name="script"}
<script>
    layui.use(['layer','table','form'],function () {
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var $ = layui.$ //由于layer弹层依赖jQuery，所以可以直接得到

    })
</script>
{/block}
